package com.lynn.baseproject

import android.app.Application
import android.content.Context
import com.lynn.baseproject.http.CustomGetAppInfo
import com.lynn.lib_base.http.HttpUtils

/**
 * @description:
 * @author: bailing
 * @datetime: 2025/5/28 11:38
 **/
class CustomApp : Application() {
    companion object {
        private var mAppContext: Context? = null

        fun getAppContext(): Context {
            if (mAppContext != null){
                return mAppContext!!
            }else{
                throw RuntimeException("The global environment variable \"context\" is null.")
            }

        }
    }

    override fun onCreate() {
        super.onCreate()
        mAppContext = applicationContext
        initHttpUtils()

    }


    private fun initHttpUtils() {
        HttpUtils.init(CustomGetAppInfo(this))
    }

    override fun onLowMemory() {
        super.onLowMemory()
    }

    override fun onTrimMemory(level: Int) {
        super.onTrimMemory(level)
    }

    override fun onTerminate() {
        super.onTerminate()
    }
}